Implement scantxoutset method and test#164
Implement scantxoutset method and test#164GideonBature wants to merge 6 commits intorust-bitcoin:masterfrom
Conversation
63e4f61 to
67b03b6
Compare
|
Why is there identical code in the v17 and v18 |
They basically work the same way, the difference is in their return type, v18 has an additional field ( |
|
Bro I explained this to you already on the other two PRs you did. Perhaps go back over them and see if you can work it out. |
oh, I now understand, I was looking at how For this recent push, I removed the repeated code across all versions having different fields in their type. |
67b03b6 to
43c8b61
Compare
|
Oh well that would explain your confusion, the |
|
Done in #169. FTR bugs happen, if you see things that are wrong or look weird just ask (or PR to fix them). Apologies for being so fierce yesterday. |
|
Returns column needs updating (and Notes). |
tcharding
left a comment
There was a problem hiding this comment.
Holy moly you picked a difficult one. I'm going to have to come back to this when I can put more thought into it. Feel free to ignore my suggestions until then.
No problem. I will do this going forward. |
Noted! |
Noted.... |
43c8b61 to
9b7f019
Compare
for the notes, is there any need to change it? since it describes perfectly that the scantxoutset is experimental. |
9b7f019 to
1a3bd20
Compare
|
Oh you are right, lets leave the notes as they are. |
1a3bd20 to
901bf21
Compare
|
Man this method is really not that simple to add support for because it changes so often. Can we put this one on hold until you've got a few more easy ones done? |
Understood... sure, let's do that. |
jamillambert
left a comment
There was a problem hiding this comment.
I made a few comments, they apply to all affected versions.
| #[rustfmt::skip] // Keep public re-exports separate. | ||
| pub use crate::client_sync::{ | ||
| v17::{AddNodeCommand, ImportMultiRequest, ImportMultiScriptPubKey, ImportMultiTimestamp, Input, Output, SetBanCommand, WalletCreateFundedPsbtInput,}, | ||
| v17::{AddNodeCommand, ImportMultiRequest, ImportMultiScriptPubKey, ImportMultiTimestamp, Input, Output, SetBanCommand, WalletCreateFundedPsbtInput |
There was a problem hiding this comment.
nit: This change is unrelated and wrong. It's not fixed by cargo fmt due to the skip above the block.
NB. I'm ok with the random fix being in this PR if done correctly though.
|
|
||
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
| pub struct ScanTxOutSetAbort(pub bool); |
| #[derive(Deserialize, Debug, Clone, PartialEq)] | ||
| pub struct ScanTxOutSetStatus { | ||
| /// Approximate percent complete | ||
| pub progress: f64, | ||
| } |
There was a problem hiding this comment.
| #[derive(Deserialize, Debug, Clone, PartialEq)] | |
| pub struct ScanTxOutSetStatus { | |
| /// Approximate percent complete | |
| pub progress: f64, | |
| } | |
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | |
| pub struct ScanTxOutSetStatus(pub f64); |
Also needs docs. Was there a reason serialize was not included that I have missed?
|
|
||
| let _: Option<ScanTxOutSetStatus> = node.client.scan_tx_out_set_status().expect("scantxoutset status"); | ||
|
|
||
| let model: Result<mtype::ScanTxOutSetStart, ScanTxOutSetError> = json.into_model(); |
There was a problem hiding this comment.
Moving this line to directly below let json makes more sense. I had to look twice and first thought the model for ..Status was being checked and not ..Start.
| pub total_amount: Amount, | ||
| } | ||
|
|
||
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] |
There was a problem hiding this comment.
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | |
| /// Unspents item returned as part of `scantxoutset` | |
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] |
Needs docs, e.g. above. Having scanned through the code a lot recently I find it useful if the original RPC is mentioned.
| } | ||
|
|
||
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
| pub struct ScanTxOutSetStart { |
There was a problem hiding this comment.
I added #[serde(deny_unknown_fields)] to this to test, and there are two missing fields, success and searched_items.
types/src/v25/blockchain/mod.rs
Outdated
| /// > Returns an object containing various state info regarding blockchain processing. | ||
| #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] | ||
| #[serde(deny_unknown_fields)] | ||
| pub struct GetBlockchainInfo { |
There was a problem hiding this comment.
Most of the changes to this file are not part of this PR, left over from a copy and paste from v19?
|
Setting to draft since this seems to be idle for now. |
|
I'll pick this up and finish it off if you have no objection @GideonBature? |
jamillambert
left a comment
There was a problem hiding this comment.
I had a quick look at this and there have been so many changes to master in the meantime the merge conflicts are going to be a pain. I would suggest dropping all exports/imports from the commit fixing the remaining merge conflicts and then adding them back manually afterwards.
Noted! |
No objection, sorry, was a little unstable that's why I left it this long. Will resolve the merge conflicts and other necessary fix. Thank you! |
|
@GideonBature are you still working on this one? |
|
@luisschwab Yes, I am currently resolving the merge conflict... |
Split single return type to three types Rename some fields for readability Rename some fields for readability
Format code
jamillambert
left a comment
There was a problem hiding this comment.
There have been a lot of changes since this PR was opened and the merge conflicts might be difficult. Let me know if you want me to take over and get it done.
52d9d1c to
3223143
Compare
|
@jamillambert I was able to resolve the merge conflict, however, you can pick it up from there, truly there have been a lot of changes since the last time I made any changes. Thank you. |
|
Then, |
jamillambert
left a comment
There was a problem hiding this comment.
@GideonBature Thanks for all the work and fixing the merge conflicts.
I'll make the last few remaining changes to get it over the line.
Thank you @jamillambert |
|
Continued in #428 |
1e51177 Implement scantxoutset method and test (GideonBature) Pull request description: The method is marked as experimental and was not implemented. Implement the method and all the changes up to v30. Original PR is #164 by GideonBature. Picked up and fixed by jamillambert. ACKs for top commit: tcharding: ACK 1e51177 Tree-SHA512: d77c346ddddc1fb41bd352c8606a63b3f66d50f951dc3f07744973f4c5a491ef572a336a54b9f87c8fb3a3013a3a29cf75c687ea8de632c3eb32270897c7b3f1
The JSON-RPC method
scantxoutsetdoes return a type. We want to test this to catch any changes in behavior in future Core versions.This PR adds a client function that errors if the return value is anything other than the type it returns, along with an integration test that calls this function.
Ref: #116
Closes #115